package com.xjtu.chapter08.thread.producer_consumer;

/**
 * @author yjq
 * @version 1.0
 * @date 2021/8/30 11:40
 */
public class ProducerAndConsumer {
    public static void main(String[] args) {
        Storage storage = new Storage();
        Thread producer = new Thread(new Producer(storage));
        producer.setName("producer");
        Thread consumer1 = new Thread(new Consumer(storage));
        Thread consumer2 = new Thread(new Consumer(storage));
        consumer1.setName("constomer1");
        consumer2.setName("constomer2");
        consumer1.start();
        consumer2.start();
        producer.start();
    }
}
